package ml.kgc.service.impl;

import ml.kgc.dao.NewsDao;
import ml.kgc.dao.impl.NewsDaoImpl;
import ml.kgc.pojo.News;
import ml.kgc.service.NewsService;

import java.util.ArrayList;
import java.util.List;

public class NewsServiceImpl implements NewsService {
    private NewsDao newsDao;

    public NewsServiceImpl(){
        newsDao = new NewsDaoImpl();
    }
    //获取新闻总数量
    public int getTotalCount(){
        return newsDao.getTotalCount();
    }
    //分页获取新闻数据
    public List<News> getPageNewsList(int pageNo,int pageSize){
        return newsDao.getPageNewsList(pageNo,pageSize);
    }

    public News getNewsById(int id){
        return newsDao.getNewsById(id);
    }


    public List<News> getNewsList() {
        return newsDao.getNewsList();
    }

    public boolean addNews(News news) {
        return newsDao.addNews(news);
    }



    public static void main(String[] args) {
        NewsDao newsDao = new NewsDaoImpl();
        List<News> list = new ArrayList<News>();
        list = newsDao.getNewsList();

    }



}
